<template>
  <div>
    <Chart :cdata="cdata"/>
  </div>
</template>

<script>
import Chart from './chart.vue';
import {
  curYearEmission,
  getProportionStage,
  getYearStageTotalCO2,
  queryAllProcessEmissionOrigin
} from "@/api/carbon-manage/data";

export default {
  data() {
    return {
      cdata: {
        xData: ["data1", "data2", "data3", "data4", "data5", "data6"],
        seriesData: [
          {value: 10, name: "燃料燃烧"},
          {value: 5, name: "1"},
          {value: 15, name: "3"},
          {value: 25, name: "4"},
          {value: 20, name: "4"},
          {value: 35, name: "42"}
        ]
      }
    }
  },
  components: {
    Chart,
  },
  mounted() {
    this.loadData()
  },
  methods: {
    loadData() {
      getYearStageTotalCO2(2024).then(res => {
        let data = res.data;
        console.log("jjjjjjjjjj")
        console.log(data)
        console.log("jjjjjjjjjj")
        this.cdata = {
          xData: ["燃料燃烧", "工业生产", "电力热力", "固碳产品"],
          seriesData: [
            {value: data['燃料燃烧'], name: "燃料燃烧"},
            {value: data['工业生产'], name: "工业生产"},
            {value: data['电力热力'], name: "电力热力"},
            {value: data['固碳产品'], name: "固碳产品"},
          ]
        };
      })
    },
  }
}
</script>

<style lang="scss" scoped>
</style>
